package com.heima.utils.thread;

import com.heima.model.admin.pojos.AdUser;

/**
 * ClassName: WmThreadLocalUtil
 * Description:
 * date: 2023/8/8 0008 16:55
 *
 * @author zHan
 */
public class AdminThreadLocalUtil {

    public static final ThreadLocal<AdUser> ADUSER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 存入线程
     *
     * @param adUser
     */
    public static void setUser(AdUser adUser) {
        ADUSER_THREAD_LOCAL.set(adUser);
    }

    /**
     * 从线程中获取
     *
     * @return
     */
    public static AdUser getUser() {
        return ADUSER_THREAD_LOCAL.get();
    }

    /**
     * 清空线程
     */
    public static void clear() {
        ADUSER_THREAD_LOCAL.remove();
    }
}
